import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '编码',
    align:"center",
    dataIndex: 'code'
   },
   {
    title: '名称',
    align:"center",
    dataIndex: 'name'
   },
   {
    title: '币种符号',
    align:"center",
    dataIndex: 'currtypesign'
   },
   {
    title: '金额小数位数',
    align:"center",
    dataIndex: 'currdigit_dictText'
   },
   {
    title: '金额进舍规则',
    align:"center",
    dataIndex: 'roundtype_dictText'
   },
   {
    title: '单价小数位数',
    align:"center",
    dataIndex: 'phonecode_dictText'
   },
   {
    title: '单价进舍规则',
    align:"center",
    dataIndex: 'unitroundtype_dictText'
   },
   {
    title: '全局本位币',
    align:"center",
    dataIndex: 'isdefault',
    customRender:({text}) => {
       return  render.renderSwitch(text, [{text:'是',value:'Y'},{text:'否',value:'N'}])
     },
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '编码',
    field: 'code',
    component: 'Input',
  },
  {
    label: '名称',
    field: 'name',
    component: 'Input',
  },
  {
    label: '币种符号',
    field: 'currtypesign',
    component: 'Input',
  },
  {
    label: '金额小数位数',
    field: 'currdigit',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"accuracy"
     },
  },
  {
    label: '金额进舍规则',
    field: 'roundtype',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"rule"
     },
  },
  {
    label: '单价小数位数',
    field: 'phonecode',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"convert_dimension"
     },
  },
  {
    label: '单价进舍规则',
    field: 'unitroundtype',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"rule"
     },
  },
  {
    label: '全局本位币',
    field: 'isdefault',
     component: 'JSwitch',
     componentProps:{
     },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  code: {title: '编码',order: 0,view: 'text', type: 'string',},
  name: {title: '名称',order: 1,view: 'text', type: 'string',},
  currtypesign: {title: '币种符号',order: 2,view: 'text', type: 'string',},
  currdigit: {title: '金额小数位数',order: 3,view: 'list', type: 'string',dictCode: 'accuracy',},
  roundtype: {title: '金额进舍规则',order: 4,view: 'list', type: 'string',dictCode: 'rule',},
  phonecode: {title: '单价小数位数',order: 5,view: 'list', type: 'string',dictCode: 'convert_dimension',},
  unitroundtype: {title: '单价进舍规则',order: 6,view: 'list', type: 'string',dictCode: 'rule',},
  isdefault: {title: '全局本位币',order: 7,view: 'switch', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}